// import messageApi from "../services/message";
const namespace = "message";
const selectState = (state) => state[namespace];
export default {
  namespace,
  state: {
    list: [],
    noticeType: 1,
  },
  reducers: {
    overrideStateProps(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
    updateStateProps(state, { payload }) {
      const { name, value } = payload;
      return {
        ...state,
        ...{ [name]: { ...state[name], ...value } },
      };
    },
  },
  effects: {
    *questMassage(action, { call, put, select }) {
      const { noticeType } = yield select(selectState);
      const params = {
        noticeType,
      };
      let data = [
        {
          mesId: "2021-06-23",
          createBy: "WX",
          createTime: "2021-06-23",
          noticeTitle: "WX002",
          content: "SJDDJDJD ",
          value: 20,
        },
        {
          mesId: "2021-06-23",
          createBy: "WX",
          createTime: "2021-06-24",
          noticeTitle: "WX002",
          content: "SJDDJDJD ",
          value: 27,
        },
        {
          mesId: "2021-06-23",
          createBy: "WX",
          createTime: "2021-06-25",
          noticeTitle: "WX002",
          content: "SJDDJDJD ",
          value: 27,
        },
        {
          mesId: "2021-06-23",
          createBy: "WX",
          createTime: "2021-06-26",
          noticeTitle: "WX002",
          content: "SJDDJDJD ",
          value: 27,
        },
      ];
      yield put({
        type: "overrideStateProps",
        payload: {
          list: data,
        },
      });
    },
  },
  subscriptions: {},
};
